package com.hadwinling.alogriithm.apilearn.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @description:
 * @author: hadwinling
 * @time: 2021/2/19 上午11:43
 */

// 从文件读取数据
public class SourceTest1_File {

    public static void main(String[] args) throws Exception {
        //创建执行文件
        StreamExecutionEnvironment executionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
        //从文件读取数据
        DataStreamSource<String> stringDataStreamSource = executionEnvironment.readTextFile("/home/hadoop/IdeaProjects/SparkScalaLearn/FlinkLearn/src/main/resources/datas/sensor.txt");

        // 打印输出
        stringDataStreamSource.print();

        // 执行
        executionEnvironment.execute();

    }
}
